//
//  RCServerOrderListCell.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-27.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "RCServerOrderListCell.h"
#import "UIColor-Expanded.h"
#import "CommonDefines.h"
#import "UIImageView+Extented.h"

#define kBGImageFile            @"image_discount_cell_bg.png"

@implementation RCServerOrderListCell{
    UILabel *_nameLabel;
    UILabel *_reserveTimeLabel;
    UILabel *_totalPeople;
    UILabel *_orderType;
    UILabel *_oderPhone;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        UIImage *bgImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:kBGImageFile ofType:nil]];
        [self setBackgroundColorWithImage:bgImage];
        self.backgroundColor = [UIColor clearColor];
        
        [self createPlaceHolder];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void) createPlaceHolder
{
    _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 160, 15)];
    [self.contentView addSubview:_nameLabel];
    _nameLabel.font = [UIFont fontWithName:kFontNameLightHeiti size:14];
    _nameLabel.textColor = kNormalOrangeTextColor;
    [_nameLabel setBackgroundColor:[UIColor clearColor]];
    [_nameLabel release];
    
    
    _reserveTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 260, 15)];
    [self.contentView addSubview:_reserveTimeLabel];
    _reserveTimeLabel.font = [UIFont systemFontOfSize:14];
    _reserveTimeLabel.textColor = kNormalTextColor;
    [_reserveTimeLabel setBackgroundColor:[UIColor clearColor]];
    [_reserveTimeLabel release];
    
    
    UILabel *totalText = [[UILabel alloc] initWithFrame:CGRectMake(10, 50, 65, 15)];
    [self.contentView addSubview:totalText];
    totalText.font = [UIFont fontWithName:kFontNameLightHeiti size:14];
    totalText.textColor = kNormalTextColor;
    [totalText setBackgroundColor:[UIColor clearColor]];
    totalText.text = @"预订人数:";
    [totalText release];
    
    _totalPeople = [[UILabel alloc] initWithFrame:CGRectMake(75, 50, 25, 15)];
    [self.contentView addSubview:_totalPeople];
    _totalPeople.font = [UIFont fontWithName:kFontNameHelvetica size:14];
    _totalPeople.textColor = kNormalTextColor;
    [_totalPeople setBackgroundColor:[UIColor clearColor]];
    [_totalPeople release];
    
    
    
    UILabel *orderText = [[UILabel alloc] initWithFrame:CGRectMake(115, 50, 65, 15)];
    [self.contentView addSubview:orderText];
    orderText.font = [UIFont fontWithName:kFontNameLightHeiti size:14];
    orderText.textColor = kNormalTextColor;
    orderText.text = @"预订类型:";
    [orderText setBackgroundColor:[UIColor clearColor]];
    [orderText release];
    
    _orderType = [[UILabel alloc] initWithFrame:CGRectMake(180, 50, 100, 14)];
    [self.contentView addSubview:_orderType];
    _orderType.font = [UIFont fontWithName:kFontNameLightHeiti size:14];
    _orderType.textColor = kNormalOrangeTextColor;
    [_orderType setBackgroundColor:[UIColor clearColor]];
    [_orderType release];
    
    UIImageView *indicator = [[UIImageView alloc] initWithFrame:CGRectMake(295, 42, 0, 0)];
    [indicator autoResizeToSetImage:[UIImage imageNamed:@"icon_RCUserVC_indicate"]];
    [self.contentView addSubview:indicator];
    [indicator release];
    
    _oderPhone = [[UILabel alloc] initWithFrame:CGRectMake(10, 70, 260, 14)];
    [self.contentView addSubview:_oderPhone];
    _oderPhone.font = [UIFont fontWithName:kFontNameHelvetica size:14];
    _oderPhone.textColor = kNormalTextColor;
    [_oderPhone setBackgroundColor:[UIColor clearColor]];
    [_oderPhone release];
    
    UIImageView *horizonLine = [[UIImageView alloc]initWithFrame:CGRectMake(0, 94, 320, 1)];
    horizonLine.backgroundColor = [UIColor clearColor];
    [horizonLine setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image_line_type3.png" ofType:nil]]];
    [self.contentView addSubview:horizonLine];
    [horizonLine release];
    
}


- (void) bindData:(RCServerOrderItem *)item
{
    _nameLabel.text = [NSString stringWithFormat:@"姓名：%@",item.name];
    _reserveTimeLabel.text = [NSString stringWithFormat:@"预订时间：%@",item.reversetime];
    _totalPeople.text = item.personCount;
    _orderType.text = item.type;
    _oderPhone.text =[NSString stringWithFormat:@"电话：%@",item.phone];
    
}

@end
